package com.tanhua.model.vo;

import com.tanhua.model.domain.UserInfo;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.io.Serializable;

@Data
@NoArgsConstructor
@AllArgsConstructor
public class UserVo implements Serializable {

    private String id; //用户id
    private String nickname; //昵称
    private String avatar; //用户头像
    private String createDate; //注册时间

    public static UserVo init(UserInfo userInfo) {
        UserVo vo = new UserVo();
        vo.setId(userInfo.getId().toString());
        vo.setNickname(userInfo.getNickname());
        vo.setAvatar(userInfo.getAvatar());
        vo.setCreateDate(userInfo.getCreated().toString());
        return vo;
    }
}